#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int numRabbits(vector<int>& answers) {
        unordered_map<int, int> hash;
        for (auto& e : answers)
        {
            hash[e + 1]++;
        }
        int res = answers.size();
        for (auto& pair : hash)
        {
            int key = pair.first;
            int value = pair.second;
            int change = value % key == 0 ? 0 : key - (value % key);
            res += change;

        }
        return res;
    }
};